Optimal. Leaf size=62 \[ \frac {(4 a-3 b) b \tanh ^{-1}(\sin (c+d x))}{2 d}+\frac {(a-b)^2 \sin (c+d x)}{d}+\frac {b^2 \sec (c+d x) \tan (c+d x)}{2 d} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.06, antiderivative size = 62, normalized size of antiderivative = 1.00, number of steps
used = 5, number of rules used = 4, integrand size = 21, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.190, Rules used = {3757, 398, 393,
212} \begin {gather*} \frac {(a-b)^2 \sin (c+d x)}{d}+\frac {b (4 a-3 b) \tanh ^{-1}(\sin (c+d x))}{2 d}+\frac {b^2 \tan (c+d x) \sec (c+d x)}{2 d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 212
Rule 393
Rule 398
Rule 3757
Rubi steps
\begin {align*} \int \cos (c+d x) \left (a+b \tan ^2(c+d x)\right )^2 \, dx &=\frac {\text {Subst}\left (\int \frac {\left (a-(a-b) x^2\right )^2}{\left (1-x^2\right )^2} \, dx,x,\sin (c+d x)\right )}{d}\\ &=\frac {\text {Subst}\left (\int \left ((a-b)^2+\frac {(2 a-b) b-2 (a-b) b x^2}{\left (1-x^2\right )^2}\right ) \, dx,x,\sin (c+d x)\right )}{d}\\ &=\frac {(a-b)^2 \sin (c+d x)}{d}+\frac {\text {Subst}\left (\int \frac {(2 a-b) b-2 (a-b) b x^2}{\left (1-x^2\right )^2} \, dx,x,\sin (c+d x)\right )}{d}\\ &=\frac {(a-b)^2 \sin (c+d x)}{d}+\frac {b^2 \sec (c+d x) \tan (c+d x)}{2 d}+\frac {((4 a-3 b) b) \text {Subst}\left (\int \frac {1}{1-x^2} \, dx,x,\sin (c+d x)\right )}{2 d}\\ &=\frac {(4 a-3 b) b \tanh ^{-1}(\sin (c+d x))}{2 d}+\frac {(a-b)^2 \sin (c+d x)}{d}+\frac {b^2 \sec (c+d x) \tan (c+d x)}{2 d}\\ \end {align*}
________________________________________________________________________________________
Mathematica [B] Leaf count is larger than twice the leaf count of optimal. \(146\) vs. \(2(62)=124\).
time = 0.49, size = 146, normalized size = 2.35 \begin {gather*} \frac {-2 (4 a-3 b) b \log \left (\cos \left (\frac {1}{2} (c+d x)\right )-\sin \left (\frac {1}{2} (c+d x)\right )\right )+2 (4 a-3 b) b \log \left (\cos \left (\frac {1}{2} (c+d x)\right )+\sin \left (\frac {1}{2} (c+d x)\right )\right )+\frac {b^2}{\left (\cos \left (\frac {1}{2} (c+d x)\right )-\sin \left (\frac {1}{2} (c+d x)\right )\right )^2}-\frac {b^2}{\left (\cos \left (\frac {1}{2} (c+d x)\right )+\sin \left (\frac {1}{2} (c+d x)\right )\right )^2}+4 (a-b)^2 \sin (c+d x)}{4 d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.19, size = 100, normalized size = 1.61
method | result | size |
derivativedivides | \(\frac {b^{2} \left (\frac {\sin ^{5}\left (d x +c \right )}{2 \cos \left (d x +c \right )^{2}}+\frac {\left (\sin ^{3}\left (d x +c \right )\right )}{2}+\frac {3 \sin \left (d x +c \right )}{2}-\frac {3 \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{2}\right )+2 a b \left (-\sin \left (d x +c \right )+\ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )\right )+a^{2} \sin \left (d x +c \right )}{d}\) | \(100\) |
default | \(\frac {b^{2} \left (\frac {\sin ^{5}\left (d x +c \right )}{2 \cos \left (d x +c \right )^{2}}+\frac {\left (\sin ^{3}\left (d x +c \right )\right )}{2}+\frac {3 \sin \left (d x +c \right )}{2}-\frac {3 \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{2}\right )+2 a b \left (-\sin \left (d x +c \right )+\ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )\right )+a^{2} \sin \left (d x +c \right )}{d}\) | \(100\) |
risch | \(-\frac {i {\mathrm e}^{i \left (d x +c \right )} a^{2}}{2 d}+\frac {i {\mathrm e}^{i \left (d x +c \right )} a b}{d}-\frac {i {\mathrm e}^{i \left (d x +c \right )} b^{2}}{2 d}+\frac {i {\mathrm e}^{-i \left (d x +c \right )} a^{2}}{2 d}-\frac {i {\mathrm e}^{-i \left (d x +c \right )} a b}{d}+\frac {i {\mathrm e}^{-i \left (d x +c \right )} b^{2}}{2 d}-\frac {i b^{2} \left ({\mathrm e}^{3 i \left (d x +c \right )}-{\mathrm e}^{i \left (d x +c \right )}\right )}{d \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )^{2}}+\frac {2 \ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) a b}{d}-\frac {3 \ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) b^{2}}{2 d}-\frac {2 \ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) a b}{d}+\frac {3 \ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) b^{2}}{2 d}\) | \(233\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A]
time = 0.29, size = 105, normalized size = 1.69 \begin {gather*} -\frac {b^{2} {\left (\frac {2 \, \sin \left (d x + c\right )}{\sin \left (d x + c\right )^{2} - 1} + 3 \, \log \left (\sin \left (d x + c\right ) + 1\right ) - 3 \, \log \left (\sin \left (d x + c\right ) - 1\right ) - 4 \, \sin \left (d x + c\right )\right )} - 4 \, a b {\left (\log \left (\sin \left (d x + c\right ) + 1\right ) - \log \left (\sin \left (d x + c\right ) - 1\right ) - 2 \, \sin \left (d x + c\right )\right )} - 4 \, a^{2} \sin \left (d x + c\right )}{4 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 1.76, size = 106, normalized size = 1.71 \begin {gather*} \frac {{\left (4 \, a b - 3 \, b^{2}\right )} \cos \left (d x + c\right )^{2} \log \left (\sin \left (d x + c\right ) + 1\right ) - {\left (4 \, a b - 3 \, b^{2}\right )} \cos \left (d x + c\right )^{2} \log \left (-\sin \left (d x + c\right ) + 1\right ) + 2 \, {\left (2 \, {\left (a^{2} - 2 \, a b + b^{2}\right )} \cos \left (d x + c\right )^{2} + b^{2}\right )} \sin \left (d x + c\right )}{4 \, d \cos \left (d x + c\right )^{2}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int \left (a + b \tan ^{2}{\left (c + d x \right )}\right )^{2} \cos {\left (c + d x \right )}\, dx \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A]
time = 0.78, size = 104, normalized size = 1.68 \begin {gather*} \frac {4 \, a^{2} \sin \left (d x + c\right ) - 8 \, a b \sin \left (d x + c\right ) + 4 \, b^{2} \sin \left (d x + c\right ) + {\left (4 \, a b - 3 \, b^{2}\right )} \log \left ({\left | \sin \left (d x + c\right ) + 1 \right |}\right ) - {\left (4 \, a b - 3 \, b^{2}\right )} \log \left ({\left | \sin \left (d x + c\right ) - 1 \right |}\right ) - \frac {2 \, b^{2} \sin \left (d x + c\right )}{\sin \left (d x + c\right )^{2} - 1}}{4 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 14.31, size = 148, normalized size = 2.39 \begin {gather*} \frac {b\,\mathrm {atanh}\left (\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\right )\,\left (4\,a-3\,b\right )}{d}-\frac {\left (2\,a^2-4\,a\,b+3\,b^2\right )\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^5+\left (-4\,a^2+8\,a\,b-2\,b^2\right )\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^3+\left (2\,a^2-4\,a\,b+3\,b^2\right )\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}{d\,\left (-{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^6+{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^4+{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2-1\right )} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________